package com.softWang.system.po;

import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.softWang.common.base.BasePO;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 系统管理-字典数据表
 */
@TableName(value = "system_dict_data", autoResultMap = true)
@KeySequence("system_dict_data_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库，可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SystemDictData extends BasePO {

    @ApiModelProperty(value = "主键id")
    @TableId
    private Long id;

    @ApiModelProperty(value = "字典类型id")
    @NotNull(message = "dictId不能为空")
    private Long dictTypeId;


    @ApiModelProperty(value = "字典类型key，长度为60")
    @Size(max = 60,message="dictKey长度为60")
    private String dictKey;


    @ApiModelProperty(value = "显示标签，长度为60")
    @NotBlank(message = "label不能为空")
    @Size(max = 60,message="label长度为60")
    private String label;


    @ApiModelProperty(value = "字典值，长度为60")
    @NotBlank(message = "value不能为空")
    @Size(max = 60,message="value长度为60")
    private String value;

    @ApiModelProperty(value = "字典排序，排序越小越靠前")
    @NotNull(message = "sort不能为空")
    private Integer sort;

    @ApiModelProperty(value = "状态,0:正常,1:停用")
    private Integer state;



    /**
     * 状态枚举
     */
    public enum State {
        /**
         * 正常
         */
        NORMAL(0),
        /**
         * 停用
         */
        DISABLE(1);


        private Integer code;

        State(Integer code) {
            this.code = code;
        }
        public Integer getCode() {
            return this.code;
        }

    }


}